{% load staticfiles %}
<!DOCTYPE html>
<html lang="zh-hans">
<head>
    <meta charset="UTF-8">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>发布</title>
    <link rel="stylesheet" href="{% static "css\bootstrap.min.css" %}">
    <link rel="stylesheet" href="{% static "css\navbar.css" %}">
    <link rel="stylesheet" href="{% static "css\form.css"%}">
    <script type="text/javascript" src="{% static "js\jquery-3.4.1.min.js" %}"></script>
    <script type="text/javascript" src="{% static "js\bootstrap.min.js" %}"></script>
</head>
<body>
<nav class="navbar navbar-inverse ">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{% url "main:home" %}"><img src="{% static "img\logo.jpg" %}" alt="失物招领"></a>
        </div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

            <ul class="nav navbar-nav navbar-right">
                <li><a href="{% url "main:found" %}" class="active">失物</a></li>
                <li><a href="{% url "main:lost" %}">寻物</a></li>
                <li><a href="#">已找到</a></li>
                <li class="dropdown">
                    {% if user.is_authenticated %}
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-picture"
                                                                                                                                                  aria-hidden="true"></span> {{ user }}
                            <span class="caret"></span></a>
                        <ul class="dropdown-menu">

                            <li><a href="{% url "main:user_center" %}"><span class="glyphicon glyphicon-new-window" aria-hidden="true"> </span> 个人中心</a></li>
                            <li role="separator" class="divider"></li>
                            <li><a href="{% url "main:log_out" %}"><span class="glyphicon glyphicon-log-out" aria-hidden="true"> </span> 登出</a>
                            </li>
                        </ul>
                    {% else %}
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-picture"
                                                                                                                                                  aria-hidden="true"></span> 未登录
                            <span class="caret"></span></a>
                        <ul class="dropdown-menu">

                            <li><a href="{% url "main:log_in" %}"><span class="glyphicon glyphicon-log-in" aria-hidden="true"> </span> 登录</a></li>
                            <li><a href="{% url "main:register" %}"><span class="glyphicon glyphicon-new-window" aria-hidden="true"> </span> 注册</a></li>

                            </li>
                        </ul>
                    {% endif %}

                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

<div class="container-form container">
    <h2>发布寻物</h2>
    <form action="" method="POST">
            {% csrf_token %}
            <div class="input-group mt-5 mb-5">
              <div class="input-group-addon">物品名称</div>
              <input type="text" class="form-control" name="item_name" placeholder="请尽量准确地输入失物名称" >
            </div>
            <br>
            <div class="input-group mt-5 mb-5">
              <div class="input-group-addon">捡到地点</div>
              <input type="text" class="form-control" name="item_location" placeholder="以 校区-建筑-房间 的格式输入" >
            </div>
            <br>
            <div class="input-group mt-5 mb-5">
              <div class="input-group-addon">捡到时间</div>
              <input class="form-control"name="item_time" type="date">
            </div>
            <br>
            <div class="input-group mt-5 mb-5">
              <div class="input-group-addon">物品描述</div>
                <textarea class="form-control" rows="3" name="item_description" type="text" placeholder="物品描述最长为50字"></textarea>
            </div>
            <br>
            <div class="input-group mt-5 mb-5">
              <div class="input-group-addon">物品类型</div>
              <select class="form-control" name="item_type">
                  <option value="校园卡">校园卡</option>
                  <option value="书籍类">书籍类</option>
                  <option value="电子产品">电子产品</option>
                  <option value="生活用品">生活用品</option>
                  <option value="学习用品">学习用品</option>
                  <option value="贵重物品">贵重物品</option>
                  <option value="其他">其他</option>
              </select>
            </div>
            <br>
            <input hidden=true type="text" value="{{user}}" name="item_publisher">
            <div class="alert alert-danger" id="alert" role = "alert">{{ error }}</div>
           <button class="btn btn-block" type="submit">发布</button>
    </form>
</div>

</body>
<script type="text/javascript">
  if ($('#alert').is(":empty")) {
    $("#alert").hide();
  }
</script>
</html>
